<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $this->title;?></title>
<link rel="stylesheet" href="<?php echo $this->baseUrl;?>/files/admin/css/main.css" />
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/jquery.js"></script>
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/load.js"></script>
<!--时间选择器-->
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/date/calendar.js"></script>
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/date/lang/cn_utf8.js"></script>
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/date/calendar-setup.js"></script>
<link rel="stylesheet" href="<?php echo $this->baseUrl;?>/files/admin/js/date/calendar-blue.css" />
<!--colorbox-->
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/colorbox.jquery/jquery.colorbox.js"></script>
<link href="<?php echo $this->baseUrl;?>/files/admin/js/colorbox.jquery/colorbox2.css" rel="stylesheet" type="text/css"/>

<!-- 选择视图-->
<script type="text/javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/highcharts/js/dm.load.js"></script>
</head>

<body style="overflow:auto;">
	<div id="main">
		<div id="topMenu">
			<div id="navigation">当前位置：访问报表</div>
			<div id="topOtherMenu"></div>
		</div>
		<div id="body">
			<div id="search">
				<form id="searchForm" name="searchForm" method="post" action="<?php echo $this->projectUrl(array('action'=>'index'));?>">
					<table>
						<tr>
							<td>
								日期：<input name="startTime" type="text" class="input" id="startTime" size="10" value="<?php echo $this->vars['startTime'];?>" />
								<script type="text/javascript">Calendar.setup({"ifFormat":"%Y-%m-%d","firstDay":0,"showsTime":false,"showOthers":false,"timeFormat":24,"inputField":"startTime","button":"startTime"});</script>
								-
								<input name="endTime" type="text" class="input" id="endTime" size="10" value="<?php echo $this->vars['endTime'];?>" />
								<script type="text/javascript">Calendar.setup({"ifFormat":"%Y-%m-%d","firstDay":0,"showsTime":false,"showOthers":false,"timeFormat":24,"inputField":"endTime","button":"endTime"});</script>
								
								&nbsp;操作系统：
								<select name="osName" id="osName" style="width:100px">
                                  <option value="">选择</option>
								  <?php foreach($this->osNames as $key =>$row):?>
									<option value="<?php echo $row['osNameFlag'];?>"
									<?php if($this->vars['osName']==$row['osNameFlag']):?>
									 selected="selected"
									<?php endif;?>
									><?php echo $row['osNameFlag'];?></option>
								  <?php endforeach;?>
                              </select>
								&nbsp;APP版本：
								<select name="version" id="version" style="width:100px">
                                  <option value="">选择</option>
                                </select>
								<input type="hidden" name="default_version" id="default_version" value="<?php echo $this->vars['version'];?>" />
								&nbsp;推广ID：<input name="sourceId" type="text" class="input" id="sourceId" size="12" value="<?php echo $this->vars['sourceId'];?>" />
								&nbsp;推广子ID：<input name="sourceSubId" type="text" class="input" id="sourceSubId" size="12" value="<?php echo $this->vars['sourceSubId'];?>" />
								<input name="search" type="submit" id="search2" value="查找" class="button" />
							
							</td>
						</tr>
					</table>
				</form>
			</div>

			<div id="content">
				<form id="listForm" name="listForm" method="post" action="">
					<table class="table">
						<tr class="subject">
							<td>机器号</td>
							<td>操作系统</td>
							<td>APP版本</td>
							<td>推广ID</td>
							<td>推广子ID</td>
							<td>访问次数</td>
							<td>访问时长</td>
							<td class="checkBoxTd">查看</td>
						</tr>
<?php 
foreach($this->rows as $key=>$row) {
?>
						<tr class="dataLine">
							<td><input name="udid" type="text" value="<?php echo $row['udid'];?>" size="20" readonly="readonly" /></td>
							<td><?php echo $row['osNameFlag'];?></td>
							<td><?php echo $row['version'];?></td>
							<td><?php echo $row['sourceId'];?></td>
							<td><?php echo $row['sourceSubId'];?></td>
							<td><?php echo $row['visitNum'];?></td>
							<td><?php echo timeToString($row['visitLength']);?></td>
							<td class="checkBoxTd"><a href="javascript:void(0);" onclick="byDate('<?php echo $this->projectUrl(array('action'=>'by-date', 'userSign'=>$row['userSign'], 'backUrl'=>urlencode($this->pageUrl))) ;?>');">查看</a></td>
						</tr>
<?php
}
?>
					</table>
				</form>
			</div>
			
			<table class="controlTable">
				<tr>
					<td colspan="6" align="right" class="paginator"><?php echo $this->pageString;?></td>
				</tr>
			</table>
			
		</div>
		</div>
	</div>
<script language="javascript">
function byDate(action){
    $('#searchForm').attr('action', action);
    $('#searchForm').submit();
}

<!-- 更新osName时，更新APP version start-->
$(function(){
	$("#osName").change(function(){
	var self=$("#version")[0];
		 $.ajax({ url: "<?php echo $this->projectUrl(array('controller'=>'act-day-data-category','action'=>'appversion'));?>",
             type:"post",           
             dataType:"json",
             data: "osName="+$("#osName option:selected").val(),
             success:function(data){ 
					self.options.length=0;
					self.options[0] = new Option('选择', '');
					var default_version=$("#default_version").val();
					$.each(data,function(i){
						self.options[i+1] = new Option(data[i], data[i]);
						if(default_version==data[i]) {										 
							self.options[i+1].selected=true;																					
						} 
					}); 
             } 
         });	
	})
	$("#osName").change();
})
<!-- 更新osName时，更新APP version end-->
</script>
</body>
</html>